<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title>预约后台管理-后台管理</title>
    <link rel="stylesheet" href="__PUBLIC__/console/css/pintuer.css">
    <link rel="stylesheet" href="__PUBLIC__/console/css/admin.css">
    <script type="text/javascript" src="__PUBLIC__/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/layer/layer.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/ajaxfileupload.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/checkAll.js"></script>
   
    <script src='/Public/js/spectrum.js'></script>
    <script src="__PUBLIC__/console/js/jquery.js"></script>
    <script src="__PUBLIC__/console/js/pintuer.js"></script>
    <script src="__PUBLIC__/console/js/respond.js"></script>
    <script src="__PUBLIC__/console/js/admin.js"></script>
    <script src="__PUBLIC__/console/js/laydate.js"></script>
    <link type="image/x-icon" href="/favicon.ico" rel="shortcut icon" />
    <link href="/favicon.ico" rel="bookmark icon" />
</head>


<!--头部 end-->
<script type="text/javascript" src="__PUBLIC__/js/ajaxfileupload.js"></script>
 <body>
<div class="lefter">
    <div class="logo"><a href="/console/index"><img src="__PUBLIC__/console/images/logo.png" alt="后台管理系统" /></a></div>
</div>
<div class="righter nav-navicon" id="admin-nav">
    <div class="mainer">
        <div class="admin-navbar">
            <span class="float-right">
              <a class="button button-little bg-main" href="/home" target="_blank">前台首页</a>
                <a class="button button-little bg-yellow" href="/Console/Base/quit">注销登录</a>
            </span>
            <ul class="nav nav-inline admin-nav">
                <li class="active"><a href="index.html" class="icon-home"> 开始</a>

                <ul>
                  <li id="shubiao"><a href="/console/console/">后台管理</a></li>
        
                  <li id="shubiao"><a href="/console/team">预约管理</a></li>
                  <li id="shubiao"><a href="/console/Blyuyue">病例预约</a></li>

                  <li id="shubiao"><a href="/console/leave">留言管理</a></li> 

                  <li id="shubiao"><a href="/Console/product">添加医生</a></li>
                  <li id="shubiao"><a href="/Console/type">添加科室</a></li>

                </ul>
                </li>
                
            </ul>
        </div>
        <div class="admin-bread">
            <span>您好，admin，欢迎您的光临。</span>
            <ul class="bread">
                <li><a href="index.html" class="icon-home"> 开始</a></li>
                <li>后台首页</li>
            </ul>
        </div>
    </div>
</div>
<!--内容页-->
<div class="admin">
    <div class="line-big">
        
       
 <!--菜单 end-->
<form  id='crewForm' >
			<div class="form-group">
                    <div class="label"><label for="title">婚庆公司名称</label></div>
                    <div class="field">
                        <input type="text" class="input"  name="td_name" size="20" value="<?php echo ($result["td_name"]); ?>" placeholder="请填写婚庆公司" data-validate="required:请填写名称，建议在12字以内。" style="width:40%;" />
                    </div>
            </div>
            <div class="form-group">
                    <div class="label"><label for="title">排序</label></div>
                    <div class="field">
                        <input type="number" class="input"  name="sort" size="20" value="<?php echo ($result["sort"]); ?>" placeholder="请填写数字" style="width:20%;" />
                    </div>
            </div>

            <div class="form-group">
                    <div class="label"><label for="logo">头像图：</label></div>
                    <div class="field">
                        <a class="button input-file" href="javascript:void(0);">+ 浏览文件
                        	<input size="100" type="file" id="fileToUploade" name="upload"  data-validate="required:请选择上传头像图片,regexp#.+.(jpg|jpeg|png|gif)$:只能上传jpg|gif|png格式文件" /></a>
                    </div>
                    
                </div>
			
             <div class="form-group">
                <div class="label"><label for="logo">头像预览图：</label></div>
            
                <img src="<?php echo ($result["td_head_img"]); ?>" alt="" id="preview" width="200px" height="200px">

                <input type="hidden"  name="td_head_img" value="<?php echo ($result["td_head_img"]); ?>">
             </div>

			 <?php $__FOR_START_14892__=0;$__FOR_END_14892__=3;for($i=$__FOR_START_14892__;$i < $__FOR_END_14892__;$i+=1){ ?><div class="form-group">
                    <div class="label"><label for="logo">产品展示图：</label></div>
                    <div class="field">
                        <a class="button input-file" href="javascript:void(0);">+ 浏览文件
                        	<input size="100" type="file" id="fileToUpload<?php echo ($i); ?>" name="upload" class='upload'  data-validate="required:请选择上传文件,regexp#.+.(jpg|jpeg|png|gif)$:只能上传jpg|gif|png格式文件" /></a>
                    </div>
                    
                </div>
		
             <div class="form-group">
                <div class="label"><label for="logo">产品预览图：</label></div>

                <img src="<?php echo ($result['td_intro_img'][$i]['img']); ?>" alt="" width="320px" height="200px">

                <input type="hidden"  name="td_intro_img[<?php echo ($i); ?>][img]" value="<?php echo ($result['td_intro_img'][$i]['img']); ?>">
             </div><?php } ?> 
              <div class="form-group">
                    <div class="label"><label for="readme">简洁介绍</label></div>
                    <div class="field">
                        <textarea class="input" name="td_text" rows="5" cols="50" placeholder="请填写简介说明" data-validate="required:请填写简介说明"><?php echo ($result["td_text"]); ?></textarea>
                    </div>
                </div>

             <div class="form-group">
                                <script src="__PUBLIC__/ue/ueditor.config.js"></script>
                                <script src="__PUBLIC__/ue/ueditor.all.min.js"></script>
                            <div class="label"><label for="readme">公司详情</label></div>
                            <div class="field">
                                <textarea  name="td_content" id="editor" rows="5" cols="50" placeholder="请填写维护说明" data-validate="required:请填写维护说明"><?php echo ($result["td_content"]); ?></textarea>
                                 <script>
                                         var ue = UE.getEditor("editor",{
                                            toolbars: [
                                                ['fullscreen', 'source',  'redo','bold','italic','|','customstyle','backcolor','removeformat', 'selectall','cleardoc', '|','justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|','fontfamily','fontsize','paragraph','forecolor',]
                                            ],
                                            autoHeightEnabled: true,
                                            autoFloatEnabled: true,
                                            initialFrameHeight:420
                                        });
                                 </script>
                              </div>
                            </div>
                            <input type="hidden" name="td_id" value="<?php echo ($result["td_id"]); ?>">
       <div class="form-button" align="center"><button class="button bg-main" id="sure" type="submit">提交</button></div>

</form>


            <br/>
          </div>
    </div>
   


</body>
</html>
 
 <!--底部 end-->
 <script>
    
    $('.tpl_img').click(function(){

        $('input:radio').removeAttr('checked');

        $(this).next().next('input').prop('checked','checked');

    })
    

    //异步表单提交
        $('#sure').click(function(){

            $.post('/Console/wedding/doUpdate',$('form').serialize(),function(data){

                if ( data.status )
                {
                    layer.alert(data.info, 1);

                    //刷新当前页
                    location.href = "/Console/wedding";
                }
                else
                {

                    layer.alert(data.info);

                }

            },'json');

            return false;

        })

      //异步图片上传
        $('body').on('change','#fileToUploade',function(){

            $.ajaxFileUpload
            (
                {
                    url:'/console/wedding/uploadImg1',
                    secureuri:false,
                    fileElementId:'fileToUploade',
                    dataType: 'json',
                    success: function (data)
                    {
                        //成功
                        if ( data.status )
                        {
                            $('#preview').attr('src', data.path);
                            $("[name='td_head_img']").val(data.path);
                        }
                        //失败
                        else
                        {
                            layer.alert(data.info);
                        }

                    }
                }
            )


        })

     //异步图片上传
        $('body').on('change','.upload',function(){

            var _this = $(this);

            var id = _this.attr('id');

            var div = _this.parent().parent().parent().next('div').children('img');

            var input = _this.parent().parent().parent().next('div').children('input');

            $.ajaxFileUpload
            (
                {
                    url:'/Console/wedding/uploadImg',
                    secureuri:false,
                    fileElementId:id,
                    dataType: 'json',
                    success: function (data)
                    {
                        //成功
                        if ( data.status )
                        {
                            div.attr('src', data.path);
                            input.attr('value',data.path);
                        }
                        //失败
                        else
                        {
                            layer.alert(data.info);
                        }

                    }
                }
            )


        })
  

</script>